﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace EMRNotes
{
    public partial class PatientProfileForm : Form
    {
        private bool cancelClosing = false;

        public string FirstName
        {
            get;
            set;
        }

        public string MiddleName
        {
            get;
            set;
        }

        public string SecondName
        {
            get;
            set;
        }

        public DateTime BirthDate
        {
            get;
            set;
        }

        public PatientProfileForm()
        {
            InitializeComponent();
        }




        private void btnOK_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == String.Empty)
            {
                MessageBox.Show("Введите фамилию");
                textBox1.Focus();
                cancelClosing = true;
                
            }
            else if (textBox2.Text == String.Empty)
            {
                MessageBox.Show("Введите имя");
                textBox2.Focus();
                cancelClosing = true;
                
            }
            else if (textBox3.Text == String.Empty)
            {
                MessageBox.Show("Введите отчество");
                textBox3.Focus();
                cancelClosing = true;
            }
            else
            {
                this.FirstName = this.textBox2.Text;
                this.MiddleName = this.textBox3.Text;
                this.SecondName = this.textBox1.Text;
                this.BirthDate = this.dateTimePicker1.Value;
                cancelClosing = false;
                this.Close();
            }


        }

        private void PatientProfileForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            e.Cancel = cancelClosing;
        }


    }
}
